#if !defined(_SSTRUCTTYPEDESCRIPTORENTRY_H)
#define _SSTRUCTTYPEDESCRIPTORENTRY_H

#include "TypeDescriptorEntry.h"
#include "TypeDescriptor.h"
#include "SType.h"
#include "Utility.h"

CREATE_ALIAS( SStructMember );

/**
 * Class used to store info of a struct member.
 */
class DECLARATION_DLL SStructMember : public TypeDescriptorEntry
{
	/** The type of the member. */
    SType type;

	/** The type descriptor of the member (valid only if the type is complex). */
	TypeDescriptorSp typeDescriptor;

	/**
	 * Create the info for a simple type struct member.
	 */
	SStructMember(string name, string description, SType type) : TypeDescriptorEntry(name, description)
	{
		this->type = type;
	}

	/**
	 * Create the info for a complex type struct member.
	 */
	SStructMember(string name, string description, TypeDescriptorSp typeDescriptor) : TypeDescriptorEntry(name, description)
	{
		this->type = typeDescriptor->GetDescribedType();
		this->typeDescriptor = typeDescriptor;
	}

	public:

		/**
		 * Get the type of the member.
		 */
		virtual SType GetType()
		{
			return type;
		}

		/**
		 * Get the name of the member.
		 */
		string GetTypeName();

		/**
		 * Get the type descriptor of the member (valid only if the type is complex).
		 */
		virtual TypeDescriptorSp GetTypeDescriptor()
		{
			return typeDescriptor;
		}

		/**
		 *   Factory method to create the info for a simple type struct member.
		 */
		static SStructMemberSp Create(string name, string description, SType type);

		/**
		 *   Factory method to create the info for a complex type struct member.
		 */
		static SStructMemberSp Create(string name, string description, TypeDescriptorSp typeDescriptor);
};

#endif  //_SSTRUCTTYPEDESCRIPTORENTRY_H
